#define _CRT_SECURE_NO_WARNINGS

int peakIndexInMountainArray(int* arr, int arrSize) {
    int left = 0;
    int right = arrSize - 1;

    while (left < right)
    {
        int mid = (right - left) / 2 + left;

        if (mid < arrSize - 1 && arr[mid] > arr[mid + 1])
            right = mid;
        else
            left = mid + 1;
    }

    return left;
}